package com.ruoyi.api.kehu;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.JiajiaHospital;
import com.ruoyi.system.service.IJiajiaHospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 医院社区Controller
 * 
 * @author mrwang
 * @date 2024-05-06
 */
@Controller
@RequestMapping("/api/kehu/hospital")
public class ApiHospitalController extends BaseController
{

    @Autowired
    private IJiajiaHospitalService jiajiaHospitalService;

    /**
     * 查询医院社区列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(JiajiaHospital jiajiaHospital)
    {
        startPage();
        List<JiajiaHospital> list = jiajiaHospitalService.selectJiajiaHospitalList(jiajiaHospital);
        return getDataTable(list);
    }

    /**
     * 新增保存医院社区
     */
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(JiajiaHospital jiajiaHospital)
    {
        return toAjax(jiajiaHospitalService.insertJiajiaHospital(jiajiaHospital));
    }

    /**
     * 修改保存医院社区
     */
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(JiajiaHospital jiajiaHospital)
    {
        return toAjax(jiajiaHospitalService.updateJiajiaHospital(jiajiaHospital));
    }

    /**
     * 删除医院社区
     */
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(jiajiaHospitalService.deleteJiajiaHospitalByIds(ids));
    }
}
